using System.Collections;
using UnityEngine;
using UnityEngine.UI;

public class OnlyDeActiveForButton : MonoBehaviour
{
	private Button btn;

	[Header("버튼 작동 시간 설정 (초)")]
	public int timer;

	[Header("타이머후 보여질 오브텍트")]
	public GameObject GO_afterDoneTimer;

	private void Awake()
	{
		btn = GetComponent<Button>();
	}

	private void OnEnable()
	{
		StartCoroutine(IE_ButtonActiveTimer());
	}

	private IEnumerator IE_ButtonActiveTimer()
	{
		yield return new WaitForSecondsRealtime(timer);
		btn.interactable = true;
		if (GO_afterDoneTimer != null)
		{
			GO_afterDoneTimer.SetActive(true);
		}
	}

	public void DeActive()
	{
		base.gameObject.SetActive(false);
	}
}
